package com.deepclassifieds.daas.api.builder;

import com.deepclassifieds.daas.api.xsd.ColumnDef;
import com.deepclassifieds.daas.api.xsd.ColumnDefs;
import com.deepclassifieds.daas.api.xsd.Table;
import com.deepclassifieds.daas.common.Builder;
import com.deepclassifieds.daas.common.Name;

public class TableBuilder implements Builder<Table> {
	
	private final Table table;
	
	public TableBuilder(Name databaseName, Name tableName) {
		this.table = new Table();
		this.table.setDatabase(databaseName.toString());
		this.table.setName(tableName.toString());
		this.table.setColumnDefs(new ColumnDefs());
	}
	
	public void addColumnDef(ColumnDef columnDef) {
		table.getColumnDefs().getColumnDef().add(columnDef);
	}

	@Override
	public Table build() {
		return table;
	}

}
